﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AzureProvider.ssdsClient;
using System.ServiceModel;

namespace AzureProvider.SoupMethods
{
    public class PingServicesMethods : BaseMethods
    {
        protected override string containerId
        {
            get { return "PingServices"; }
        }

        protected override string kind
        {
            get { return "PingService"; ; }
        }

        protected override Entity CreateEntity(object Object)
        {

            var entity = new Entity()
                {
                    Id = Guid.NewGuid().ToString(),
                    Kind = kind
                };

                entity.Properties = new Dictionary<string, object>();
                entity.Properties.Add("URI", Object);
               
            return entity;
        }

        public override object CreateObject(Entity Entity)
        {
            String myObj = (string)Entity.Properties.Single(tt => tt.Key == "URI").Value;
            return myObj;
        }


        public IEnumerable<String> GetPingServices(string query, out string errMessage)
        {
            return base.GetObjects(query, out errMessage).Cast<string>();
        }
    }
}
